package com.yjc.dp;

import com.sun.javafx.image.impl.IntArgb;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 746. 使用最小花费爬楼梯
 *
 * @author yjc
 * @create 2024-07-18 15:12
 */
public class Subject_1 {
    public static void main(String[] args) {

        int[] cost = {10, 15, 20};

        int n = cost.length;
        int[] dp = new int[n + 1];//加的一相当于是顶楼
        dp[0] = dp[1] = 0;
        for (int i = 2; i <= n; i++) {
            dp[i] = Integer.min(dp[i - 1] + cost[i - 1], dp[i - 2] + cost[i - 2]);
        }
        System.out.println(dp[n]);

    }
}
